import doctest
#import sys
#import os
#from StringIO import StringIO
from spiny import *

######################################
# THIS IS THE CODE UNDER TEST
######################################

def printsquares(count,start=0):
    result = []
    for i in range(count):
        result.append(i * i) 
    return result

def printa():
    return "a"

######################################
# TEST CODE
######################################

def banner(char="!",count=1,width=80):
    for i in range(count): print width * char

if __name__ == "__main__":

    banner('+',3)
    
    globs = globals()
    doctest.testfile('testfile.txt',globs = globs,verbose=False)

    banner()
    
    runner = doctest.DocTestRunner(verbose=False)
    parser = SpinyParser(True)

    text = open('testfile.txt').read()
    test = parser.get_doctest(text,globs,'testfile','testfile.txt',0)

    runner.run(test)
    runner.summarize()
    
    banner('-',2)

    